<template>
	<view class="mainpadding2">
		<view class="flexcolumn" v-if="list.data.length==0">
			<view class="placeholderimage" style="margin-top: 200rpx;"></view>
			<view class="xiaohui margin_top main_size">暂无数据</view>
		</view>
		<view class="flexstart margin_top6" v-for="item in list.data" :key="item.id" @click="jumpdetail('/pages_piaoquan/piaoquanxq?id=',item.id)">
			<image :src="item.user.avatar_text" class="radius" style="width: 90rpx;height: 90rpx;min-width: 90rpx;" mode=""></image>
			<view class="margin_left2" style="width: 100%;">
				<view class="titletext xiaohei fonweight">{{item.user.nickname}}</view>
				<view class="xiaohei ershil margin_top2">{{item.title}}</view>
				<view class="xiaohui ershil margin_top2 lianghang">{{item.content}}</view>
				<view class="flexleft flex_wrap">
					<view class="sanshis flexcenter" v-for="(ite,ind) in item.images_text" :key="ind">
						<view class="margin_top2" style="width: 180rpx;height: 180rpx;">
							<image :src="ite" class=" radius" style="width: 100%;height: 100%;" mode=""></image>
						</view>
					</view>
				</view>
				<view class=" flexbetween margin_top2">
					<view class="xiaohui strongtext">{{item.createtime_text}}</view>
					<view class="flexright">
						<u-icon name="chat" color="#999" size="20"></u-icon>
						<view class="xiaohui strongtext margin_left1">{{item.comment_num}}</view>
					</view>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	const httpRequest = require("@/common/httpRequest.js")
	export default {
		data() {
			return {
				page: 1,
				limit: 12,
				list: {
					data: []
				},
			}
		},
		onShow() {
			this.init()
		},
		onPullDownRefresh() {
			this.init()
		},
		methods: {
			init(isPage, page) {
				let _this = this
				httpRequest.request('/api/userdtcl/dtIndex', 'GET', {
					page: page || 1,
					limit: 12,
				}).then(res => {
					uni.stopPullDownRefresh()
					if (res.code == 1) {
						let resList = res.data;
						let dataList = _this.list;
						if (isPage == true) {
							_this.list.data = dataList.data.concat(resList.data);
						} else {
							this.list = res.data
							_this.list.data = resList.data;
						}
					}
				}).catch(err => {
					httpRequest.toast(err.msg);
				})
			},
			onReachBottom() {
				let _this = this;
				let list = _this.list;
				let page = _this.page;
				if (list.last_page <= page) {
					return false;
				}
				page++;
				_this.page = page;
				_this.init(true, page);
			},
		}
	}
</script>

<style>

</style>
